import 'package:flutter/material.dart';
import 'package:flutter_app/router_config.dart';
import 'package:flutter_app/state/user.dart';
import 'package:flutter_app/theme/theme_config.dart';
import 'package:provider/provider.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final UserStore userStore = UserStore();
  await userStore.loadIsLogin();
  runApp(MultiProvider(
    providers: [
      ChangeNotifierProvider.value(value: userStore),
    ],
    child: const MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      theme: MyTheme.themeData,
      debugShowCheckedModeBanner: false,
      routerConfig: routerConfig,
    );
  }
}
